reverse words in a string leetcode java code